<template>
  <div class="menuNavigation-box" :class="{ 'menuNavigation-item-wap': store.isMobileType }">
    <div
      @click="openprogres"
      :class="{  'is-hover': !store.isMobileType }"
      class="menuNavigation-item"
    >
      <div
        class="item-left"
        :style="{ 'background-image': `url(${publicUrls + 'free/style13/menuNavigationItemLeft1.png'})` }"
      >
        <div class="item-content freeIcon">&#xe663;</div>
      </div>
    </div>
    <div
      @click="handleMouseEnter(1)"
      :class="{ 'item-active': showType === 1, 'is-hover': !store.isMobileType }"
      class="menuNavigation-item"
    >
      <div
        class="item-left"
        :style="{ 'background-image': `url(${publicUrls + 'free/style13/menuNavigationItemLeft1.png'})` }"
      >
        <div class="item-content doorIcon">&#xe679;</div>
      </div>
    </div>
    <div
      @click="handleMouseEnter(2)"
      :class="{ 'item-active': showType === 2, 'is-hover': !store.isMobileType }"
      class="menuNavigation-item"
    >
      <div
        class="item-left"
        :style="{ 'background-image': `url(${publicUrls + 'free/style13/menuNavigationItemLeft1.png'})` }"
      >
        <div class="item-content doorIcon">&#xe67a;</div>
      </div>
    </div>
    <div
      v-if="props.isMobile"
      :class="{ 'item-active': showType === 3, 'is-hover': !store.isMobileType }"
      class="menuNavigation-item"
      @click="follow"
    >
      <div
        class="item-left"
        :style="{ 'background-image': `url(${publicUrls + 'free/style13/menuNavigationItemLeft1.png'})` }"
      >
        <div v-if="commonStore.isStart" class="item-content doorIcon item-start start-active">&#xe629;</div>
        <div v-else class="item-content doorIcon item-start">&#xe628;</div>
      </div>
    </div>
    <div
      v-if="props.isMobile"
      :class="{ 'item-active': showType === 4, 'is-hover': !store.isMobileType }"
      class="menuNavigation-item"
    >
      <t-popup
        class="placement align"
        content=""
        placement="left"
        attach="#menuNavigation-tem"
        destroyOnClose
        :trigger="store.isMobileType ? 'click' : 'hover'"
        :overlay-inner-style="(triggerElem) => ({ background: `transparent`, 'box-shadow': 'none' })"
      >
        <template #content>
          <Shear @shearType="shearType" />
        </template>
        <div
          class="item-left"
          :style="{ 'background-image': `url(${publicUrls + 'free/style13/menuNavigationItemLeft1.png'})` }"
        >
          <div class="item-content doorIcon item-content-share">&#xe647;</div>
        </div>
      </t-popup>
    </div>
    <!-- <a
      :href="commonStore.digitalShowroom"
      target="blank"
      v-if="commonStore.digitalShowroom"
      :class="{ 'item-active': showType === 5, 'is-hover': !store.isMobileType }"
      class="menuNavigation-item"
    >
      <div
        class="item-left"
        :style="{ 'background-image': `url(${publicUrls + 'free/style13/menuNavigationItemLeft1.png'})` }"
      ></div>
      <div class="item-right">
        <span>全景</span>
      </div>
    </a> -->
    <div
      @wheel="pageWheel"
      class="shadow"
      @click="close"
      v-if="(showType === 1 || showType === 2 || showType === 4) && show"
    ></div>
    <div
      class="scroll-box"
      :class="
        showType === 1 || showType === 4
          ? 'scroll-box-active'
          : showType === 2
          ? 'scroll-box-active2'
          : 'scroll-box-down'
      "
    >
      <div
        class="scroll-box-top"
        :style="{ 'background-image': `url(${publicUrls + 'free/style13/scrollTopBg1.png'})` }"
      ></div>
      <div class="scroll-box-content">
        <div class="scroll-box-content-component">
          <div class="content-title-parent">
            <p class="content-title">
              {{ showType == 1 ? '目录' : showType == 2 ? '更多板块' : showType == 4 ? '分享' : '' }}
            </p>
          </div>
          <div class="list">
            <div class="list-content" v-if="showType === 1">
              <div class="item" @click="scroolPath(item.id)" v-for="item in store.templateMOdeList" :key="item.id">
                <p class="item-title">{{ item.text }}</p>
              </div>
            </div>
            <div class="list-content list-content-mg" v-else-if="showType === 2">
              <RouterList @emitPath="scrollHandleMouseLeave" />
            </div>
            <div class="list-content" v-else-if="showType === 4">
              <div class="item-share" @click="shearType(index)" v-for="(item, index) in shareList" :key="index">
                <div class="doorIcon">{{ item.icon }}</div>
                <p class="item-share-title">{{ item.text }}</p>
              </div>
            </div>
          </div>
        </div>
      </div>
      <div
        class="scroll-box-top"
        :style="{ 'background-image': `url(${publicUrls + 'free/style13/scrollTopBg2.png'})` }"
      ></div>
    </div>
  </div>
  <!-- <messageModel
    submitText="前往"
    title="提示"   
    :visible="visibleMessage"
    problem="您暂未登录"      
    message="是否前往登录？" 
    @closeClick="closeClick" 
    @submitClick="pathSubmitClick"
  /> -->
</template> 
 
<script lang="ts">
export default defineComponent({
  name: 'style13',
});
</script>

<script setup lang="ts">
import { getHeardToken } from '@/api/utils';
import { psthOutline, psthOutlineRoute } from '@/hooks/menuHooks';
import RouterList from '../menuComponent/routerList13.vue';
import { publicUrls } from '@/utils/minxin';
import { ref, reactive, watch, nextTick, computed, defineComponent } from 'vue';
import { useProjectStore } from '@/store';
import style1 from './style/style1.vue';
import { commonDataStore } from '@/store';
import { toQQ, toQQzone, toWeibo } from '@/utils/shear';
import { AddFollow } from '@/api/door/door';
import Shear from '../menuComponent/templateShear.vue';
import { useRoute } from 'vue-router';

const props = defineProps({
  isMobile: {
    type: Boolean,
  },
});
const commonStore = commonDataStore();
const show = ref(false);
const showType = ref(0);
const timer = ref();
const store = useProjectStore();
const visibleMessage = ref(false);
const FollowType = ref(false);
const route = useRoute();
const shareList = reactive([
  {
    icon: '\ue623',
    text: '分享此展览到QQ',
  },
  {
    icon: '\ue616',
    text: '分享此展览到QQ空间',
  },
  {
    icon: '\ue615',
    text: '分享此展览到微博',
  },
]);

commonStore.getMenuList();
const handleMouseEnter = (type: number) => {
  showType.value = type;
  show.value = true;
};
const openprogres = () => {
  store.setprogressVisible();
};
const mouseenterHover = () => {};

const scrollHandleMouseLeave = () => {
  showType.value = 0;
  show.value = false;
};
const scroolPath = (id: number) => {
  psthOutlineRoute('Level1outline' + id, route.meta.loopType);
  scrollHandleMouseLeave();
};
const follow = () => {
  let token = getHeardToken();
  if (!token) {
    // visibleMessage.value = true;
    store.loginModeShow = true;
    return;
  } else {
    commonStore.setFollow();
    handleMouseEnter(3);
  }
};
const pageWheel = (event: any) => {
  const delta = Math.sign(event.wheelDelta || -event.detail);
  const scrollContainer = document.getElementById('edit-scroll-box');
  if (delta > 0) {
    if (scrollContainer.scrollLeft === 0) {
    } else {
      scrollContainer.scrollLeft = scrollContainer.scrollLeft - 100;
    }
  } else {
    scrollContainer.scrollLeft = scrollContainer.scrollLeft + 100;
  }
  event.preventDefault();

  // scrollRef
};
//分享
const shearType = (e: number) => {
  let url = window.location.href;
  let title = '';
  handleMouseEnter(4);
  switch (e) {
    case 0:
      toQQ(url, title);
      break;
    case 1:
      toQQzone(url, title);
      break;
    case 2:
      toWeibo(url, title);
      break;
  }
  scrollHandleMouseLeave();
};

//取消登录
const closeClick = () => {
  visibleMessage.value = false;
};
const close = () => {
  showType.value = 0;
  show.value = false;
};
//确认登录
const pathSubmitClick = () => {
  visibleMessage.value = false;
  let url = window.location.href;
  let redirectUrl = 'http://wz.wuzhan.art/#/login?redirect=' + url;
  window.location.href = redirectUrl;
};
</script>

<style lang="less" scoped>
.menuNavigation-box {
  display: flex;
  flex-direction: column;
  position: fixed;
  bottom: 40px;
  right: -77px;
  // right: 0px;
  width: 144px;
  z-index: 1021;
}
.menuNavigation-item {
  position: relative;
  cursor: pointer;
  display: flex;
  align-items: center;
  width: 144px;
  margin-top: 20px;
  transition: all 0.3s;
  z-index: 666;
  transform: translateY(0px);
}
::v-deep .placement {
  display: flex;
  align-items: center;
}
.item-left {
  position: relative;
  width: 50px;
  height: 50px;
  background-repeat: no-repeat;
  background-size: 100% 100%;
  z-index: 30;
}
.item-content {
  width: 50px;
  height: 50px;
  font-size: 24px;
  color: #333333;
  display: flex;
  justify-content: center;
  align-items: center;
  position: relative;
  z-index: 1;
}
.item-right {
  display: flex;
  align-items: center;
  width: 119px;
  height: 44px;
  margin-left: -25px;
  padding-left: 29px;
  border: 1px solid rgba(255, 255, 255, 0.63);
  background: rgba(255, 255, 255, 0.8);
  span {
    font-family: SourceHanSerifCN-Bold;
    font-size: 16px;
    line-height: 32px;
    text-align: left;
    color: rgba(173, 144, 114, 1);
    opacity: 0;
    transition: all 0.5s ease;
  }
}

// .is-hover {
// }

.scroll-box {
  display: flex;
  flex-direction: column;
  align-items: center;
  position: fixed;
  // top: 340px;
  bottom: 40px;
  right: 100px;
  overflow: hidden;
  z-index: 20;
}
.shadow {
  position: fixed;
  bottom: 0;
  left: 0;
  width: 1440px;
  height: 900px;
}
.scroll-box-top {
  width: 100%;
  height: 32px;
  background-repeat: no-repeat;
  background-size: 100% 100%;
  flex-shrink: 0;
}

.scroll-box-content {
  display: flex;
  justify-content: center;
  align-items: center;
  width: 100%;
  height: 0px;
  transition: all 0.3s;
  background: #eee;
  overflow: hidden;
  margin-top: -1px;
}
.scroll-box-content-component {
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 100%;
  height: 100%;
  padding: 14px 16px;
}
.content-title-parent {
  position: relative;
  width: 100%;
  height: 32px;
  margin-bottom: 8px;
}
.content-title {
  font-family: Slidexiaxing;
  font-size: 28px;
  color: #333333;
  line-height: 34px;
  text-align: center;
}
.list {
  width: 100%;
  flex: 1;
  overflow: auto;
  scrollbar-width: none;
}
.list::-webkit-scrollbar {
  display: none;
}
.list-content {
  width: 100%;
  height: 100%;
  background: #ffffff;
  padding: 16px 0;
  overflow: auto;
  scrollbar-width: none;
}
.list-content-mg {
  height: 100%;
  display: flex;
  justify-content: center;
}
.item {
  width: 100%;
  display: flex;
  justify-content: center;
  height: 32px;
  margin-bottom: 10px;
  &:last-child {
    margin-bottom: 0;
  }
}
.item-share {
  width: 100%;
  display: flex;
  justify-content: center;
  align-items: center;
  height: 32px;
  margin-bottom: 10px;
  color: #88786b;
  &:hover {
    .item-share-title {
      color: #6c5c4f;
      text-decoration: underline;
    }
    .freeIcon {
      color: #6c5c4f;
    }
  }
  .doorIcon {
    font-size: 20px;
    margin-right: 4px;
  }
  .freeIcon {
    font-size: 20px !important;
  }
  .item-share-title {
    width: 156px;
    font-family: 'PingFang SC';
    font-size: 16px;
    line-height: 32px;
    cursor: pointer;
  }
}

.item-title {
  cursor: pointer;
  font-family: SourceMedium;
  font-size: 16px;
  line-height: 32px;
  text-align: center;
  color: rgba(51, 51, 51, 0.6);
  width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.item-title:hover {
  font-family: 'SourceHanSerifCN-Bold';
  color: rgba(51, 51, 51, 1);
  text-decoration: underline;
}
.scroll-box-active {
  transition: all 0.3s;
  width: 408px;
  height: 522px;
  opacity: 1;
  .scroll-box-content {
    width: 373px !important;
  }
  .scroll-box-content {
    height: 490px;
    overflow: auto;
  }
}
.scroll-box-active2 {
  transition: all 0.3s;
  width: 256px;
  height: 522px;
  opacity: 1;
  .scroll-box-content {
    width: 232px !important;
    height: 490px;
    overflow: auto;
  }
}
.scroll-box-down {
  transition: all 0.3s;
  width: 420px;
  opacity: 0;
  height: 0;
  .scroll-box-content {
    overflow: auto;
  }
}
.menuNavigation-item-wap {
  bottom: 200px;
  transform: translateZ(1px);
  .menuNavigation-item {
    transform: scale(1.5);
    margin-top: 42px;
    // position: relative;
    // cursor: pointer;
    // display: flex;
    // align-items: center;
    // width: 144px;
    // margin-top: 20px;
    // transition: all 0.3s;
    // z-index: 666;
  }
  .scroll-box {
    transform: scale(1.3);
    top: -130px;
    right: 250px;
  }
  // .item-left {
  //   position: relative;
  //   width: 50px;
  //   height: 50px;
  //   background-repeat: no-repeat;
  //   background-size: 100% 100%;
  //   z-index: 30;
  // }
  // .item-right {
  //   display: flex;
  //   align-items: center;
  //   width: 119px;
  //   height: 44px;
  //   margin-left: -25px;
  //   padding-left: 29px;
  //   border: 1px solid rgba(255, 255, 255, 0.63);
  //   background: rgba(255, 255, 255, 0.8);
  //   span {
  //     font-family: SourceHanSerifCN-Bold;
  //     font-size: 16px;
  //     line-height: 32px;
  //     text-align: left;
  //     color: rgba(173, 144, 114, 1);
  //   }
  // }
}
</style>